package com.yYclass.service;

import com.yYclass.controller.request.ShortLinkAddRequest;
import com.yYclass.controller.request.ShortLinkDelRequest;
import com.yYclass.controller.request.ShortLinkPageRequest;
import com.yYclass.controller.request.ShortLinkUpdateRequest;
import com.yYclass.model.EventMessage;
import com.yYclass.model.ShortLinkDO;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yYclass.util.JsonData;
import com.yYclass.vo.ShortLinkVO;

import java.util.Map;

/**
 * <p>
 *  服务类
 * </p>
 *
 * @author 栗永松
 * @since 2024-09-14
 */
public interface ShortLinkService extends IService<ShortLinkDO> {
    /**
     * 新增
     * @param shortLinkDO
     * @return
     */
    int addShortLink(ShortLinkDO shortLinkDO);


    /**
     * 根据短链码找短链
     * @param shortLinkCode
     * @return
     */
    ShortLinkDO findByShortLinCode(String shortLinkCode);


    /**
     * 删除
     * @param shortLinkDO
     * @return
     */
    int del(ShortLinkDO shortLinkDO);

    ShortLinkVO parseShortLinkCode(String shortLinkCode);
    /**
     * 创建短链
     * @param request
     * @return
     */
    JsonData createShortLink(ShortLinkAddRequest request);

    /**
     * 处理新增短链消息
     * @param eventMessage
     * @return
     */
    boolean handleAddShortLink(EventMessage eventMessage);

    Map<String, Object> pageByGroupId(ShortLinkPageRequest request);

    JsonData delShortLink(ShortLinkDelRequest request);

    JsonData updateShortLink(ShortLinkUpdateRequest request);
    /**
     * 处理删除短链消息
     * @param eventMessage
     * @return
     */
    boolean handleDelShortLink(EventMessage eventMessage);
    /**
     * 处理更新短链消息
     * @param eventMessage
     * @return
     */
    boolean handleUpdateShortLink(EventMessage eventMessage);

    /**
     * 更新操作
     * @param shortLinkDO
     * @return
     */
    Integer update(ShortLinkDO shortLinkDO);
}
